package com.juyu.miliao.scheduler.service.impl;

import com.juyu.miliao.scheduler.dao.redis.SignInRedisDao;
import com.juyu.miliao.scheduler.service.SignInService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDate;

/**
 * @ClassName: SignInServiceImpl
 * @Description: TODO
 * @Author zhangcheng
 * @Date 19-9-16上午9:27
 */
@Service
public class SignInServiceImpl implements SignInService {
    private final Logger signInLogger = LoggerFactory.getLogger("signIn");
    @Resource
    private SignInRedisDao signInRedisDao;

    @Override
    public void resetSignInData() {
        signInLogger.info("开始重置签到天数");
        int day = LocalDate.now().getDayOfWeek().getValue();
        signInRedisDao.resetConsecutiveDays(day == 1);
        signInLogger.info("完成重置签到天数");
    }

    @Override
    public void testRestSignInData() {
        signInLogger.info("开始测试重置签到天数");
        int day = LocalDate.now().getDayOfWeek().getValue();
        signInRedisDao.testResetConsecutiveDays(day == 1);
        signInLogger.info("完成测试重置签到天数");
    }

}
